package cn.lyd.base.enm;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

@Getter
@AllArgsConstructor
public enum ProductStateEnum {
    //员工状态：0下架，1上架
    ACTIVITY_NO_PASS(0L,"下架"),
    ACTIVITY(1L,"上架");


    public static String getNameByCode(Integer code){
        Optional<ProductStateEnum> first = Arrays.stream(ProductStateEnum.values()).filter(state -> state.getCode().equals(code))
                .findFirst();
        return first.isPresent()?first.get().getName():"";
    }

    private Long code;

    private String name;
}
